<!DOCTYPE html>
<html>
<head>
    <title>jQuery WeUI</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.">
    <link rel="stylesheet" href="../css/weui.css">
    <link rel="stylesheet" href="../css/jquery-weui.css">
    <link rel="stylesheet" href="../css/demos.css">
    <script src="../js/jquery-2.1.1.min.js"></script>
    <script src="../js/main.js"></script>
    <script src="../layer/layer.js"></script>
    <script src="../js/fastclick.js"></script>

</head>

<body>


<div id="d" style="padding-bottom:10%;width:100%;height:0;margin-top: 1rem;background-color: black;margin-top: 0px;">
    <div style="width:70%;margin:auto auto;">
        <img src="../img/index/top.png" style="height: auto;width:100%; margin:auto auto;"/>
    </div>
</div>

<div class="weui-panel weui-panel_access">
    <div class="weui-panel__hd">选择删除个人服务</div>
    <div class="weui-panel__bd" id="data">

        <!--<div class="weui-cell">-->
            <!--<div class="weui-cell__bd">-->
                <!--<div class="weui-cell__bd">-->
                    <!--<p>服务</p>-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="weui-cell__ft weui-swiped-btn weui-swiped-btn_default" onclick="delService(2)">删除</div>-->
        <!--</div>-->

    </div>
</div>




<script src="../js/jquery-weui.js"></script>
<script>
    $.ajaxSetup({
        xhrFields: {
            withCredentials: isCrossDomain
        }
    });
    $(function () {
        $.get(mainurl+"skill/getServiceId",function (data) {
           if(checkData(data)) {
               for(var i=0; i<data.data.length; i++) {
                   var id = data.data[i];
                   $("#data").append("<div class=\"weui-cell \">\n" +
                       "            <div class=\"weui-cell__bd\">\n" +
                       "                <div class=\"weui-cell__bd\">\n" +
                       "                    <p>资源编号:"+id+"</p>\n" +
                       "                </div>\n" +
                       "            </div>\n" +
                       "            <div class=\"weui-cell__ft weui-swiped-btn weui-swiped-btn_default\" onclick=\"delService("+id+")\">删除</div>\n" +
                       "        </div>")
               }

           }
        })
    });

    function delService(i,o) {
        layer.confirm('是否确认删除？', {
            btn: ['是的','取消'] //按钮
        }, function(){//y
            $.post(mainurl+"skill/delService",{sid:i},function (data) {
                if(checkData(data)) {
                    $("div[onclick='delService("+i+")']").parents('.weui-cell').remove();
                    successInfo("删除成功");
                }
            });
            layer.closeAll();
        }, function(){

        });
    }
</script>

</body>
</html>
